\(\int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx\) [309]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 32, antiderivative size = 48 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {b B x}{a^2+b^2}-\frac {a B \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right ) d} \]

[Out]

b*B*x/(a^2+b^2)-a*B*ln(a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2)/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {21, 3612, 3611} \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {b B x}{a^2+b^2}-\frac {a B \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )} \]

[In]

Int[(Tan[c + d*x]*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^2,x]

[Out]

(b*B*x)/(a^2 + b^2) - (a*B*Log[a*Cos[c + d*x] + b*Sin[c + d*x]])/((a^2 + b^2)*d)

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rubi steps \begin{align*} \text {integral}& = B \int \frac {\tan (c+d x)}{a+b \tan (c+d x)} \, dx \\ & = \frac {b B x}{a^2+b^2}-\frac {(a B) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^2+b^2} \\ & = \frac {b B x}{a^2+b^2}-\frac {a B \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right ) d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.11 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.40 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {B \left (2 (-i a+b) (c+d x)+2 i a \arctan (\tan (c+d x))-a \log \left ((a \cos (c+d x)+b \sin (c+d x))^2\right )\right )}{2 \left (a^2+b^2\right ) d} \]

[In]

Integrate[(Tan[c + d*x]*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^2,x]

[Out]

(B*(2*((-I)*a + b)*(c + d*x) + (2*I)*a*ArcTan[Tan[c + d*x]] - a*Log[(a*Cos[c + d*x] + b*Sin[c + d*x])^2]))/(2*
(a^2 + b^2)*d)

Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.06

method result size
parallelrisch \(\frac {2 B b d x +B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a -2 B \ln \left (a +b \tan \left (d x +c \right )\right ) a}{2 d \left (a^{2}+b^{2}\right )}\) \(51\)
derivativedivides \(\frac {B \left (\frac {\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {a \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{2}+b^{2}}\right )}{d}\) \(64\)
default \(\frac {B \left (\frac {\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {a \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{2}+b^{2}}\right )}{d}\) \(64\)
risch \(\frac {i x B}{i b -a}+\frac {2 i B x a}{a^{2}+b^{2}}+\frac {2 i B a c}{d \left (a^{2}+b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B a}{d \left (a^{2}+b^{2}\right )}\) \(95\)
norman \(\frac {\frac {b B a x}{a^{2}+b^{2}}+\frac {b^{2} B x \tan \left (d x +c \right )}{a^{2}+b^{2}}}{a +b \tan \left (d x +c \right )}+\frac {B a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {B a \ln \left (a +b \tan \left (d x +c \right )\right )}{d \left (a^{2}+b^{2}\right )}\) \(105\)

[In]

int(tan(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*(2*B*b*d*x+B*ln(1+tan(d*x+c)^2)*a-2*B*ln(a+b*tan(d*x+c))*a)/d/(a^2+b^2)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.35 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {2 \, B b d x - B a \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{2} + b^{2}\right )} d} \]

[In]

integrate(tan(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/2*(2*B*b*d*x - B*a*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + c)^2 + 1)))/((a^2 + b^2)*d
)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.58 (sec) , antiderivative size = 282, normalized size of antiderivative = 5.88 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\begin {cases} \tilde {\infty } B x & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a d} & \text {for}\: b = 0 \\\frac {B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {B}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\\frac {B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {B}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \left (B a + B b \tan {\left (c \right )}\right ) \tan {\left (c \right )}}{\left (a + b \tan {\left (c \right )}\right )^{2}} & \text {for}\: d = 0 \\- \frac {2 B a \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {B a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {2 B b d x}{2 a^{2} d + 2 b^{2} d} & \text {otherwise} \end {cases} \]

[In]

integrate(tan(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))**2,x)

[Out]

Piecewise((zoo*B*x, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (B*log(tan(c + d*x)**2 + 1)/(2*a*d), Eq(b, 0)), (B*d*x*ta
n(c + d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) - I*B*d*x/(2*b*d*tan(c + d*x) - 2*I*b*d) - B/(2*b*d*tan(c + d*x) - 2
*I*b*d), Eq(a, -I*b)), (B*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + I*B*d*x/(2*b*d*tan(c + d*x) + 2*I*
b*d) - B/(2*b*d*tan(c + d*x) + 2*I*b*d), Eq(a, I*b)), (x*(B*a + B*b*tan(c))*tan(c)/(a + b*tan(c))**2, Eq(d, 0)
), (-2*B*a*log(a/b + tan(c + d*x))/(2*a**2*d + 2*b**2*d) + B*a*log(tan(c + d*x)**2 + 1)/(2*a**2*d + 2*b**2*d)
+ 2*B*b*d*x/(2*a**2*d + 2*b**2*d), True))

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.48 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {\frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} - \frac {2 \, B a \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} + b^{2}} + \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]

[In]

integrate(tan(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/2*(2*(d*x + c)*B*b/(a^2 + b^2) - 2*B*a*log(b*tan(d*x + c) + a)/(a^2 + b^2) + B*a*log(tan(d*x + c)^2 + 1)/(a^
2 + b^2))/d

Giac [A] (verification not implemented)

none

Time = 0.38 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.58 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, B a b \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b + b^{3}} - \frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} - \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]

[In]

integrate(tan(d*x+c)*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(2*B*a*b*log(abs(b*tan(d*x + c) + a))/(a^2*b + b^3) - 2*(d*x + c)*B*b/(a^2 + b^2) - B*a*log(tan(d*x + c)^
2 + 1)/(a^2 + b^2))/d

Mupad [B] (verification not implemented)

Time = 8.75 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.65 \[ \int \frac {\tan (c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )}-\frac {B\,a\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{d\,\left (a^2+b^2\right )}+\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )} \]

[In]

int((tan(c + d*x)*(B*a + B*b*tan(c + d*x)))/(a + b*tan(c + d*x))^2,x)

[Out]

(B*log(tan(c + d*x) + 1i))/(2*d*(a - b*1i)) + (B*log(tan(c + d*x) - 1i)*1i)/(2*d*(a*1i - b)) - (B*a*log(a + b*
tan(c + d*x)))/(d*(a^2 + b^2))